#coding:utf-8


class TestCase(object):
    def __init__(self, data= [], repeat = 1, patience = 10, rest = 0):
        object.__init__(self)
        self.setData(data)
        self.setPatience(patience)
        self.setRepeat(repeat)
        self.setRest(rest)

    def getBussType(self):
        return self.data[:2]
    
    def getBussData(self):
        return self.data[2:]
    
    def getData(self):
        return self.data
    
    def setData(self, data):
        assert isinstance(data, list)
        self.data = data
        
    def getRest(self):
        return self.rest
    
    def setRest(self, value):
        self.rest = int(value)
        
    def getPatience(self):
        return self.patience
    
    def setPatience(self, value):
        self.patience = int(value)
        
    def getRepeat(self):
        return self.repeat
    
    def setRepeat(self, value):
        self.repeat = int(value)
        
    def getUseTime(self):
        return (self.patience + self.rest) * self.repeat
    
    
class TestFlow(object):
    def __init__(self, name = ""):
        object.__init__(self)
        self.name = name
        self.testList = []
        
    def appendTestCase(self, testCase):
        self.testList.append(testCase)
        
    def insertTestCase(self, index, testCase):
        self.testList.insert(index, testCase)
    
    def removeTestCase(self, index):
        return self.testList.pop(index)
    
    def setName(self, name):
        self.name = name
        
    def getName(self):
        return self.name
    
    def setTestList(self, testList):
        isinstance(testList, list)
        self.testList = testList
        
    def getTestList(self):
        return self.testList
    
    def getCount(self):
        return len(self.testList)
        
        